package com.xinhe.web.reposity;

import com.xinhe.web.entity.BankCard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface BankCardRepository  extends JpaRepository<BankCard, Long> {
    @Query(value = "select *  from tb_bank_card  where removed = 0 and f_user_id = ?1 and is_default = ?2",nativeQuery = true)
    BankCard findOneByUserIdAndIsDefault(Long fUserId, Integer integer);
    @Query(value = "select *  from tb_bank_card  where removed = 0 and f_user_id = ?1",nativeQuery = true)
    List<BankCard> findByUserId(Long userId);
    @Query(value = "select *  from tb_bank_card  where removed = 0 and code = ?1",nativeQuery = true)
    BankCard findOneByCode(String code);
}
